﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form2 : Form
    {


        public Form2()
        {
            InitializeComponent();
        }
        private void Form2_Load(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection("server= ;database=Articles;user=sa;pwd= ");
            connection.Open();
            SqlDataReader sqlDataReader = components.ExecuteReader();
            while (sqlDataReader.Read())
            {
                sqlDataReader.Close();
            }

        }

        class Utils
        {
            private static object retrun;

            public static void Updatedata(string sql)
            {
                SqlConnection connection = new SqlConnection();
                connection.Open();

                SqlConnection connection = new SqlConnection();

            }
            public static DataTable GetDataSet(string safeSql)
            {
                SqlConnection connection = new SqlConnection();

                if (Exception.Message.Contanins("连接超时!", "时间已到")
                {
                    MessageBox.Show("连接服务器超时！", "提示");
                    retrun null;
                }
                else
                {
                    throw Exception;
                }
                finally
                {
                    if (connection != null && connection.State == System.Data.ConnectionState.Open)
                    {
                        connection.Close();
                    }
                    else if (connection ! = null && connection.State == System.Data.ConnectionState.Broken){
                        connection.Close();
                    }
                }
            }



        }
    }
} 
